package com.esdemo.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.Date;

/**
 * 商品详细主表
 */
@Document(indexName = "b2b_shangcheng",type = "Shopping")
public class Shopping implements Serializable {

    @Id
    private Integer id;
    /**
     * 商品名称
     * KeyWord:初始化是如果不设计KeyWord那么你检索的值就会被分词(Text)
     */
    @Field(type = FieldType.Text)
    private String shop_name;
    /**
     * 商品促销价
     */
    private double shop_price;
    /**
     * 商品原价
     */
    private double shop_new_price;
    /**
     * 商品描述
     * analyzer = "ik_max_word",searchAnalyzer = "ik_max_word"
     */
    @Field(type=FieldType.Text, analyzer = "ik_max_word",searchAnalyzer = "ik_max_word",store = true)
    private String shop_desc;
    /**
     * 库存
     */
    private Integer shop_count;
    /**
     * 商品规格储存1,2,3分别对应不同的属性(如：颜色，尺码，样式)
     */
    private String shop_spectifications;

    /**
     * 商品图片
     */
    private String shop_img_url;
    /**
     * 所属分类(只统计父级分类为0的ParentId)
     */
    @Field(type = FieldType.Keyword)
    private String shop_type;
    /**
     * 游览次数(排名靠前)
     */
    private String shop_sale_count;
    /**
     * 更新时间
     */
    @Field(type=FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date shop_release_time;

    /**
     * 是否为本期秒杀商品(默认：0不是，1秒杀)
     */
    private Integer is_hot_sale;
    /**
     * 秒杀时间
     */
    @Field(type=FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date hot_sale_time;
    /**
     * 秒杀结束时间
     * @return
     */
    @Field(type=FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date hot_sale_time_end;

    public Date getHot_sale_time_end() {
        return hot_sale_time_end;
    }

    public void setHot_sale_time_end(Date hot_sale_time_end) {
        this.hot_sale_time_end = hot_sale_time_end;
    }

    public Integer getIs_hot_sale() {
        return is_hot_sale;
    }

    public void setIs_hot_sale(Integer is_hot_sale) {
        this.is_hot_sale = is_hot_sale;
    }

    public Date getHot_sale_time() {
        return hot_sale_time;
    }

    public void setHot_sale_time(Date hot_sale_time) {
        this.hot_sale_time = hot_sale_time;
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getShop_name() {
        return shop_name;
    }

    public void setShop_name(String shop_name) {
        this.shop_name = shop_name;
    }

    public double getShop_price() {
        return shop_price;
    }

    public void setShop_price(double shop_price) {
        this.shop_price = shop_price;
    }

    public double getShop_new_price() {
        return shop_new_price;
    }

    public void setShop_new_price(double shop_new_price) {
        this.shop_new_price = shop_new_price;
    }

    public String getShop_desc() {
        return shop_desc;
    }

    public void setShop_desc(String shop_desc) {
        this.shop_desc = shop_desc;
    }

    public Integer getShop_count() {
        return shop_count;
    }

    public void setShop_count(Integer shop_count) {
        this.shop_count = shop_count;
    }

    public String getShop_spectifications() {
        return shop_spectifications;
    }

    public void setShop_spectifications(String shop_spectifications) {
        this.shop_spectifications = shop_spectifications;
    }

    public String getShop_img_url() {
        return shop_img_url;
    }

    public void setShop_img_url(String shop_img_url) {
        this.shop_img_url = shop_img_url;
    }

    public String getShop_type() {
        return shop_type;
    }

    public void setShop_type(String shop_type) {
        this.shop_type = shop_type;
    }

    public String getShop_sale_count() {
        return shop_sale_count;
    }

    public void setShop_sale_count(String shop_sale_count) {
        this.shop_sale_count = shop_sale_count;
    }

    public Date getShop_release_time() {
        return shop_release_time;
    }

    public void setShop_release_time(Date shop_release_time) {
        this.shop_release_time = shop_release_time;
    }

}
